import React from 'react';
export default class Form extends React.Component {
    constructor(props) {
        super(props);
    }
    render() {
        var count =0;
        const keepTwoDecimal=(num)=>{
            var result = parseFloat(num);
            result = Math.round(num * 100) / 100;
            return result;
        }
        return <section className="orderC">
            <div className="order">
                <div className="banner">
                    <h3>订单详情</h3>
                    <ul>
                        {
                            this.props.forminfo.map((item, idx) => {
                                 let priceC = 0;
                                priceC = item.productQuantity * item.productPrice;
                                count+=priceC;
                                return <li key={idx}>
                                    <div className="product">
                                        <h4>{item.productName}</h4>
                                    </div>
                                    <div className="data">
                                        <span className="quantity">×{item.productQuantity}</span>
                                        <span className="price">￥{item.productPrice}</span>
                                    </div>
                                </li>
                            })
                        }
                        <li>
                            <h4 className="count">总计</h4>
                            <span className="countP">￥{keepTwoDecimal(count)}</span>
                        </li>
                    </ul>
                </div>
            </div>
            <div className="info">
                <div className="banner">
                    <h3>订单信息</h3>
                    <ul>
                        <li>
                            <h4>下单时间</h4>
                            <span>{this.props.createTime}</span>
                        </li>
                        <li>
                            <h4>订单编号</h4>
                            <span>{this.props.orderId}</span>
                        </li>
                    </ul>
                </div>
            </div>
        </section>
    }
}
